Row

confirmed

1661

Active Cases

1116

recovered

479

death

73

Row

Map

Daily cumulative cases

Row

Zipcode cases

Town cases

Row

Daily counts

Daily counts

date confirmed new active recovered deaths
31 2020-04-13 1661 37 1116 479 66
30 2020-04-12 1624 66 1084 479 61
29 2020-04-11 1558 52 1071 430 57
28 2020-04-10 1506 66 1019 430 57
27 2020-04-09 1440 95 989 398 53
26 2020-04-08 1345 110 950 349 46
25 2020-04-07 1235 72 893 303 39
24 2020-04-06 1163 104 910 223 30
23 2020-04-05 1059 114 861 171 27
22 2020-04-04 945 143 758 161 26
21 2020-04-03 802 68 639 141 22
20 2020-04-02 734 131 614 101 19
19 2020-04-01 603 50 510 81 12
18 2020-03-31 553 90 481 62 10
17 2020-03-30 463 49 402 53 8
16 2020-03-29 414 34 375 32 7
15 2020-03-28 380 70 347 27 6
14 2020-03-27 310 89 277 27 6
13 2020-03-26 221 75 200 16 5
12 2020-03-25 146 25 139 5 2
11 2020-03-24 121 25 121 0 0
10 2020-03-23 96 32 96 0 0
9 2020-03-22 64 8 64 0 0
8 2020-03-21 56 9 56 0 0
7 2020-03-20 47 18 47 0 0
6 2020-03-19 29 2 29 0 0
5 2020-03-18 27 7 27 0 0
4 2020-03-17 20 13 20 0 0
3 2020-03-16 7 0 7 0 0
2 2020-03-15 7 4 7 0 0
1 2020-03-14 3 3 3 0 0
---
title: COVID19 in Erie county
date: "`r gsub('\\(updated |\\ EST)|/2020', '', attributes(Counts$counts)$update.time)`"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    navbar:
      - { icon: fa-github, href: "https://github.com/hubentu/COVID19Erie"}
      - { title: "Erie Case Map", href: "https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1"}
      - { title: "Global Map", href: "https://coronavirus.jhu.edu/map.html"}
    social: menu
    source_code: embed
    vertical_layout: scroll
---

```{r setup, include=FALSE}
library(flexdashboard)
library(fontawesome)
## library(COVID19Erie)
## pubExposed <- exposedPub()
```

```{r}
Counts <- caseCounts()
counts <- Counts$counts
ctable1 <- rbind(counts,
                c(town = "Total", colSums(counts[,-1])))
ycount <- historyCount$confirmed[historyCount$date == Sys.Date() - 1]
ncount <- attributes(counts)$total.confirmed - ycount
```

Row {data-width=300}
-----------------------------------------------------------------------

### confirmed {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.confirmed,
  caption = paste0("Total confirmed cases (+", ncount, ")"),
  icon = "fas fa-ambulance",
  color = "purple"
)
```

### Active Cases {.value-box}
```{r}
valueBox(
  value = attributes(counts)$active.cases,
  caption = "Active cases",
  icon = "fas fa-hospital-user",
  color = "#1f77b4"
)
```

### recovered {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.recovered,
  caption = "Total recovered cases",
  icon = "fas fa-head-side-mask",
  color = "forestgreen"
)
```

### death {.value-box}

```{r}
valueBox(
  value = attributes(counts)$total.deaths,
  caption = "Death cases",
  icon = "fas fa-heart-broken",
  color = "#474747"
)
```


Row {data-height=600}
-----------------------------------------------------------------------
    
### Map
    
```{r}
caseMap(Counts, pubExposed, titlePos = NULL)
```

### Daily cumulative cases
```{r}
countPlot(historyCount)
```

Row
---------------------------------------------------------------------

### Zipcode cases
```{r}
library(DT)
datatable(Counts$zipCounts, options = list(scrollX = T))
```

### Town cases

```{r}
## library(knitr)
## library(kableExtra)
## kable(ctable1,
##       caption = "COVID19 cases (Erie county)") %>%
##     kable_styling(full_width = TRUE) %>% 
##     footnote(general = c(paste("Last updated:", attributes(counts)$update.time),
##                          "[Data Source](https://erieny.maps.arcgis.com/apps/opsdashboard/index.html#/dd7f1c0c352e4192ab162a1dfadc58e1)",
##                          "[Public Advisories](http://www2.erie.gov/health/index.php?q=public-advisories)",
##                          "The data is only for educational and academic research purposes.")) %>%
## scroll_box(height = "600px")
datatable(ctable1[,1:2], options = list(scrollX = T))
```

Row
----------------------------------------------------------------------

### Daily counts {.no-mobile}
```{r}
datatable(historyCount[order(historyCount$date, decreasing = TRUE),],
          extensions = 'Scroller',
          options = list(scrollX = TRUE))
```

### Daily counts {.mobile}
```{r}
library(knitr)
library(kableExtra)
kable(historyCount[order(historyCount$date, decreasing = TRUE),]) %>%
    kable_styling(font_size = 8)%>%
    scroll_box(height = "600px", width = "100%")
```